﻿var OfficePartner = Backbone.Model.extend({
    defaults: {
        'id': '0',
        'IsActive': true,
        'nocache': (new Date()).toJSON()
    },

    //nhan biet them moi hay cap nhat dl;
    isNew: function () {
        var id = this.get('id');
        if (!id || id == 0) {
            return true;
        } else {
            return false;
        }
    },

    //thuc hien  them hay cap nhat;
    url: function () {
        if (this.isNew()) {
            return '/officepartner/add_item';
        } else {
            return '/officepartner/update_item';
        }
    }
});
//khai bao collection
var OfficePartnerCollection = Backbone.Collection.extend({
    model : OfficePartner
});